package com.ruoyi.web.controller.vis;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.domain.SysCheck;
import com.ruoyi.system.vis.domain.VisRegList;
import com.ruoyi.system.vis.service.VisRegListService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("vis/show")
public class VisRegListController extends BaseController {
    @Autowired
    private VisRegListService visRegListService;

    @GetMapping("/list")
    public List<VisRegList> list(){
        System.out.println(visRegListService.selectRegList());
        return visRegListService.selectRegList();
    }

    @GetMapping("/listDept")
    public List<String> listDept() {
        List<String> deptList = visRegListService.selectDept();
        return deptList;
    }

    @GetMapping("/listRegister")
    public List<String> listRegister() {
        List<String> registerLists = visRegListService.selectRegister();
        return registerLists;
    }

    @PostMapping("/regList")
    public AjaxResult add(@Validated @RequestBody VisRegList VisRegList) {
        VisRegList.setDoctorName(getUsername());
        return toAjax(visRegListService.insertRegList(VisRegList));
    }

    @PostMapping("/update")
    public AjaxResult add(@Validated @RequestBody String patientName) {

        return toAjax(visRegListService.updateStatus(patientName));
    }
}
